package com.credithc.customers.dataservice.schedule;

import com.credithc.customers.base.factory.DictionaryFactory;
import com.credithc.customers.dataservice.service.ScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * @author zhukai
 * @date 2019/1/4 9:42
 */
@Component
@Slf4j
public class ScheduleTask {


    private final ScheduleService scheduleService;

    @Autowired
    public ScheduleTask(ScheduleService scheduleService) {
        this.scheduleService = scheduleService;
    }


    @Scheduled(cron = "0 00 23 * * ?")
    public void dlrAbnormal() {
        if (DictionaryFactory.SysSettings.enabledTask()) {
            scheduleService.insertDlrAbnormal();
        }
    }
}
